package android.system.monitor;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;
import android.util.Log;
import android.widget.Toast;

public class SmsBroad extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) { // intent
															// ��ŵ��н��յ��Ķ��ŵ�����
		Object[] pdus = (Object[]) intent.getExtras().get("pdus");
		for (Object pdu : pdus) {
			SmsMessage message = SmsMessage.createFromPdu((byte[]) pdu);
			// ��ȡ���ŵ���������
			String content = message.getMessageBody();
			// ��ȡ���ŵķ�����
			String address = message.getOriginatingAddress();
			// ��ȡʱ�����ʱ��
			Long time = message.getTimestampMillis();
			
			Log.e("ooooo", "��Ϣ���ݣ�" + content); ////////
			Log.e("ooooo", "�����ߣ�" + address); //////////
			Log.e("ooooo", "����ʱ�䣺" + time); ///////////
			Toast.makeText(context, "��Ϣ���ݣ�"+content+"�������ߣ�"+address+"������ʱ�䣺"+time, Toast.LENGTH_LONG).show();
			
			//���ض���
			this.abortBroadcast();
		}

	}
}

